﻿<sdk:Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:AdventureWorksLT.Views.Customers.ViewModels" 
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:E2C="clr-namespace:AdventureWorksLT.Core"
xmlns:appControls="clr-namespace:AdventureWorksLT.Controls"
x:Class="AdventureWorksLT.Views.Customers.Controls.SalesOrderHeaderWorkWithGrid"
mc:Ignorable="d"
d:DesignWidth="840" d:DesignHeight="480"
Title="Sales Order Header WorkWithGrid"
>
    <sdk:Page.Resources>
        <viewModels:SalesOrderHeadersViewModel x:Key="SalesOrderHeadersViewModel" />
    </sdk:Page.Resources>
        <appControls:BusyIndicator x:Name="BusyIndicator" BusyContent="Loading SalesOrderHeaders data...." DataContext="{Binding Source={StaticResource SalesOrderHeadersViewModel}}" FontSize="18" IsBusy="{Binding IsBusy}">
        <ScrollViewer x:Name="scrollViewerSalesOrderHeader" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" >
    <Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SalesOrderHeadersViewModel}}"  >
<sdk:DataGrid Margin="5" Style="{StaticResource DataGridCellJetPackStyle2}" CellStyle="{StaticResource LeftCell}" ColumnHeaderStyle="{StaticResource DataGridColumnHeader2}" RowHeaderStyle="{StaticResource DataGridRowHeader}" RowStyle="{StaticResource DataGridRow}" AutoGenerateColumns="False" IsReadOnly="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" DataContext="{Binding Source={StaticResource SalesOrderHeadersViewModel}}" ItemsSource="{Binding SalesOrderHeadersCollection, Mode=TwoWay}" x:Name="SalesOrderHeadersDataGrid" >
 <i:Interaction.Triggers>
 <i:EventTrigger EventName="SelectionChanged">
 <E2C:EventToCommand Command="{Binding SelectionChangedSdkCommand}" CommandParameter="{Binding SelectedItem, ElementName=SalesOrderHeadersDataGrid}" ></E2C:EventToCommand>
 </i:EventTrigger>
 </i:Interaction.Triggers>
 <sdk:DataGrid.Columns >
                        <sdk:DataGridTemplateColumn x:Name="ModifyRow" Width="20">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Content="..." ToolTipService.ToolTip="Modify This Sales Order" DataContext="{Binding Source={StaticResource SalesOrderHeadersViewModel}}" >
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <E2C:EventToCommand Command="{Binding EditCurrentInNewWindowCommand}" CommandParameter="{Binding SelectedItem, ElementName=SalesOrderHeadersDataGrid}" ></E2C:EventToCommand>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </Button>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
     
 <sdk:DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=SalesOrderID}" Header="Sales Order Id" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn x:Name="CustomerIDColumn" Binding="{Binding Path=CustomerID}" Header="Customer ID" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn x:Name="RevisionNumberColumn" Binding="{Binding Path=RevisionNumber}" Header="Revision Number" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="OrderDateColumn" Binding="{Binding Path=OrderDate}" Header="Order Date" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="DueDateColumn" Binding="{Binding Path=DueDate}" Header="Due Date" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="ShipDateColumn" Binding="{Binding Path=ShipDate}" Header="Ship Date" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="StatusColumn" Binding="{Binding Path=Status}" Header="Status" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="OnlineOrderFlagColumn" Binding="{Binding Path=OnlineOrderFlag}" Header="Online Order Flag" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="SalesOrderNumberColumn" Binding="{Binding Path=SalesOrderNumber}" Header="Sales Order Number" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="PurchaseOrderNumberColumn" Binding="{Binding Path=PurchaseOrderNumber}" Header="Purchase Order Number" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="AccountNumberColumn" Binding="{Binding Path=AccountNumber}" Header="Account Number" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="ShipMethodColumn" Binding="{Binding Path=ShipMethod}" Header="Ship Method" Width="SizeToHeader" />
</sdk:DataGrid.Columns>
                             </sdk:DataGrid>

    </Grid>
  </ScrollViewer>
 </appControls:BusyIndicator>
</sdk:Page>

